<?php
    defined('BASEPATH') OR exit('No direct script access allowed');
    class User extends CI_Controller
    {
        public function __construct()
        {
            parent::__construct();
            $this->load->model('User_model');
        }
        public function insert()
        {
            $arr = array('username'=>'u2','password'=>'124312','realname'=>'shit','age'=>111);
            $this->User_model->user_insert($arr);
        }
        public function update()
        {
            $id = 2;
            $arr = array('username'=>'u11111','password'=>'222222','realname'=>'shi22222','age'=>41);
            $this->User_model->user_update($id,$arr);
        }
        public function del()
        {
            $id =3;
            $this->User_model->user_delete($id);
        }
         public function select()
        {
            $user = $this->User_model->user_select(2);
            var_dump($user[0]);
            //对象转数组的方法;
            // $user =  json_decode( json_encode($user[0]),true);
            echo $user[0]['username'];
        }
        
    }
?>